﻿using System.ServiceModel;
using VideoStore.Services.Dto;
using VideoStore.Common.Response;

namespace VideoStore.Services.Interface
{
    [ServiceContract(Namespace = "VideoStore.Services.StockService")]
    public interface IStockService
    {
        /// <summary>
        /// Gets the item by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        [OperationContract]
        Response<StockDto> GetItemById(int id);

        /// <summary>
        /// Creates the item.
        /// </summary>
        /// <param name="newStock">The new stock.</param>
        /// <returns></returns>
        [OperationContract]
        [TransactionFlow(TransactionFlowOption.Allowed)]
        Response<StockDto> CreateItem(StockDto newStock);

        /// <summary>
        /// Solds the specified catalogue id.
        /// </summary>
        /// <param name="catalogueId">The catalogue id.</param>
        /// <param name="quantity">The quantity.</param>
        /// <param name="warehouseId">The warehouse id.</param>
        /// <returns></returns>
        [OperationContract]
        [TransactionFlow(TransactionFlowOption.Allowed)]
        Response<int> Sold(int catalogueId, int quantity, int warehouseId);

        /// <summary>
        /// Boughts the specified catalogue id.
        /// </summary>
        /// <param name="catalogueId">The catalogue id.</param>
        /// <param name="quantity">The quantity.</param>
        /// <param name="warehouseId">The warehouse id.</param>
        /// <returns></returns>
        [OperationContract]
        [TransactionFlow(TransactionFlowOption.Allowed)]
        Response<int> Bought(int catalogueId, int quantity, int warehouseId);
    }
}
